from integration.alarmsHandle.alarms import Ararms
from integration.alarmsHandle.alarms_execl import Alarms_Execl


class Alarms_Focus:
    def __init__(self, zhi, main_zhi):
        self.__dict__.update(main_zhi)
        super().__init__()
        self.focus(zhi)

    def focus(self, zhi):
        self.name = zhi[-1]
        self.accessToken = zhi[6]
        self.url = zhi[5]
        zhi = 'alarmsHandle_EXCEL'
        self.svn_path = self.db_manager.select_cookies(zhi)[0][-3]

    def select(self, select):
        if select == 1:
            self.login()
        elif select == 2:
            self.alarms_execl()

    def login(self):
        Ararms(self.__dict__).login()

    def alarms_execl(self):
        Alarms_Execl(self.__dict__).Alarms_Execl_can()
